Added version info
authorJeroen van der Heijden <jeroen@transceptor.technology>
Sat, 6 Oct 2018 10:31:49 +0000 (12:31 +0200)
committerJeroen van der Heijden <jeroen@transceptor.technology>
Sat, 6 Oct 2018 10:31:49 +0000 (12:31 +0200)
itest/testing/args.py
itest/testing/color.py
itest/testing/constants.py
itest/testing/server.py

index da7171de7f3145408b76e046b9b8660f99c3c588..424f19b13265ba51a4a38f04d1a064bc7ce0efb6 100644 (file)
@@ -3,6 +3,7 @@ import subprocess
 import argparse
 from .server import Server
 from .color import Color
+from .constants import SIRIDBC
 
 
 def is_valgrind_installed():
@@ -15,6 +16,26 @@ def is_valgrind_installed():
     return True
 
 
+def print_siridb_version(args):
+    fn = SIRIDBC.format(BUILDTYPE=args.build)
+    try:
+        p = subprocess.Popen(
+            [fn, '--version'],
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE)
+    except FileNotFoundError:
+        print(Color.error(f'Cannot find: {fn}'))
+        exit(1)
+
+    output, err = p.communicate()
+    rc = p.returncode
+    if rc or err:
+        print(Color.error(f'Cannot use: {fn}'))
+        exit(1)
+
+    print(f'Test with: {Color.info(output.decode().splitlines()[0])}')
+
+
 def parse_args():
     parser = argparse.ArgumentParser()
 
@@ -52,6 +73,7 @@ def parse_args():
 
     has_valgrind = is_valgrind_installed()
 
+    print_siridb_version(args)
     print("Test using valgrind for memory errors and leaks: ", end='')
     if args.mem_check and not has_valgrind:
         print(Color.warning('disabled (!! valgrind not found !!)'))
index ff28fe21d6e1ac70037e88841aad57fca3bd7302..729d1191c684f7e87b7296632bef6b278eeb6739 100644 (file)
@@ -3,6 +3,7 @@ NORMAL = '\x1B[0m'
 RED = '\x1B[31m'
 GREEN = '\x1B[32m'
 YELLOW = '\x1B[33m'
+LYELLOW = '\x1b[93m'
 
 
 class Color:
@@ -19,4 +20,6 @@ class Color:
     def error(text):
         return f'{RED}{text}{NORMAL}'
 
-
+    @staticmethod
+    def info(text):
+        return f'{LYELLOW}{text}{NORMAL}'
index e578923e666fba2919b51df2056e8afebd14af36..b4a59329aa2a47bbfeca8c59b49577380e5ae58a 100644 (file)
@@ -1,4 +1,3 @@
-BUILDTYPE = 'Debug'
 TEST_DIR = './testdir'
 SIRIDBC = '../{BUILDTYPE}/siridb-server'
 ADMIN = '/usr/local/bin/siridb-admin'
index 2b9b4b313c74c880f61d26c7e60b6403712db267..a641207c50bce293119ab052dd784d5170fee54b 100644 (file)
@@ -10,7 +10,6 @@ import platform
 from .constants import SIRIDBC
 from .constants import TEST_DIR
 from .constants import VALGRIND
-from .constants import BUILDTYPE
 from .constants import MAX_OPEN_FILES
 
 MEM_PROC = \
@@ -22,7 +21,7 @@ class Server:
     HOLD_TERM = False
     GEOMETRY = '140x60'
     MEM_CHECK = False
-    BUILDTYPE = BUILDTYPE
+    BUILDTYPE = 'Release'
     SERVER_ADDRESS = '%HOSTNAME'
     IP_SUPPORT = 'ALL'
     TERMINAL = None  # one of [ 'XTERM', 'XFCE4_TERMINAL', None  ]